import 'package:flutter/material.dart';
import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';

class FirstPage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}


class _HomePageState extends State<FirstPage> {
  // 定义轮播图
  List _imagesUrls = [
    'https://picx.zhimg.com/80/v2-6b65282beac97dc7c492371a160b3b82_720w.webp?source=1def8aca',
    'https://img2.baidu.com/it/u=3924547169,2320541332&fm=253&fmt=auto&app=138&f=JPEG?w=638&h=416',
  ];

  @override
  Widget build(BuildContext context) {
    // 创建根节点: 导航
    return Scaffold(
      body: Center(
        child: Column(
          children: [
            Container(
              height: 160,
              child: Swiper(
                itemCount: _imagesUrls.length,
                autoplay: true,
                itemBuilder: (BuildContext context, int index) {
                  return Image.network(
                    _imagesUrls[index],
                    fit: BoxFit.fill,
                  );
                },
                pagination: SwiperPagination(),
              ),
            ),
          ],
        ),
      ),
    );

  }
}